package com.hanqian.kepler.core.dao.primary.core;

import com.hanqian.kepler.common.base.dao.BaseDao;
import com.hanqian.kepler.core.entity.primary.core.TargetDescEvaluate;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * newFile
 * ============================================================================
 * author : dzw
 * createDate:  2021/1/6 。
 * ============================================================================
 */
public interface TargetDescEvaluateDao extends BaseDao<TargetDescEvaluate, String> {

	/**
	 * 获取总评论数
	 */
	@Query(value = "SELECT count(*) FROM kepler_target_evaluate eva " +
			"inner join kepler_target_desc desc1 on eva.targetDesc_id=desc1.id and eva.versionIndex=desc1.versionIndex " +
			"left join kepler_target target on desc1.target_id=target.id " +
			"where eva.state='Enable' and target.state='Enable' and desc1.state='Enable'",
			nativeQuery = true)
	Long findEnableCount();

}
